1. Field of the Invention
The present invention relates to a wear-leveling method, and more particularly, to a method and apparatus for wear-leveling of a nonvolatile data storage device, whereby a wear-leveling effect is maximized by storing an age value indicating a write time in each data unit of the nonvolatile data storage device and detecting a static data area by using age values.
2. Description of the Related Art
Recently, flash memories, which are a kind of nonvolatile data storage device used in various multimedia devices including mobile devices, are being widely used as a preferred storage device due to characteristics of flash memories, such as low power consumption, small size, low heat production and high stability, and also due to the rapidly increasing storage size of a single flash memory.
However, in general, flash memories have a slow programming (write) speed, and, in order to update a block in which data is recorded, the block must be erased before a write operation is performed with respect to the block.
Every block that constitutes a basic unit of an erase operation can endure a number of erase counts, termed the endurance condition. For example, 100,000 erase counts for a Single Level Cell (SLC) type and 10,000 erase counts for a Multiple Level Cell (MLC) type. The endurance condition is also applied to other nonvolatile data storage devices in which write and erase operations can be performed, and thus, the description below can be generally applied to all nonvolatile data storage devices.
If frequent update occurs in a specific block of a memory, a bad block may be generated due to an aging process, resulting in a rapid decrease of lifespan of the entire memory. In order to prevent the aging process, a file system which is used to manage flash memories, such as Flash Translation Layer (FTL) system, requires a wear-leveling scheme, and a lifespan of a memory significantly depends on a wear-leveling method employed.
FIG. 1 is a graph showing the number of erase counts per block of a flash memory when using a counting runtime only method according to the prior art.
A wear-leveling method used to manage the number of erase counts generally uses a method of storing the number of erase counts per block, which can be divided into two methods. A first method is a method in which a management table containing information on the number of erase counts is stored in the flash memory, and a second method is a method in which the management table containing information on the number of erase counts is stored in a memory (Random Access Memory (RAM)) of a system driving the flash memory. The above described second method is the counting runtime only method.
According to the first method (stored in the flash memory), the number of erase counts with a physical block address of the flash memory is stored in a block map table included in the flash memory, and only a map table cache is stored in the system memory. Thus, since the number of erase counts per block is stored in the flash memory, correct wear-leveling of the flash memory can be performed, however, computational overheads of the block map table become twice as large due to the additional information on the number of erase counts.
According to the second method (the counting runtime only method), only the physical block address is stored in the block map table included in the flash memory, and the information on the number of erase counts is stored and managed in the system memory in a form of an erase count array. Since the information on the number of erase counts is reset when power of the system is turned off, it is difficult to perform ideal wear-leveling of the flash memory, however, no computational overhead is required to update the block map table included in the flash memory.
Referring to FIG. 1, when the second method (the counting runtime only method) in which there is no computational overhead is used, the number of erase counts is shown generally even due to the wear-leveling method by means of management of the number of erase counts, address re-mapping and garbage collection functions basically operated by the FTL.
Referring to block numbers 0 to 749, it can be seen that differences between erase counts per block are not very large.
However, referring to block numbers 749 to 953 (referred to as reference numeral 110), the number of erase counts per block is very small, and thus, a difference of the number of erase counts between the blocks of the block numbers 749 to 953 and other surrounding blocks is very large. The area 110 is a static data area in which data is secured for a long time without being updated or erased. When the second method is used, it is difficult to exactly detect the static data area 110 due to resetting of information on the number of erase counts.
In a wear-leveling method using the second method (the counting runtime only method), since information regarding wear (information on the number of erase counts) is reset when power of a system is turned off, if the static data area 110 is widely distributed throughout the storage device a wear-leveling effect is considerably decreased.
FIG. 2 is a flowchart for describing a wear-leveling method with respect to static areas in a flash memory according to the prior art.
Referring to FIG. 2, in the wear-leveling method with respect to static areas according to the prior art, a number of write or erase operations is counted in operation 210, and when a counting value is a multiple number of a selected number, e.g. 1000, a random process is activated in operation 220, and the wear-leveling method begins in operation 230. By setting a specific selection order in operation 240 or activating a random process in operation 250, a unit is selected in operation 260, data of the selected unit is moved to another free unit in operation 270, and the selected unit is erased.
However, according to the wear-leveling method, since movement or swapping of blocks occurs with respect to the entire flash memory using a random function, swapping of blocks which are not in a static data area occurs frequently. That is, since swapping between free units or swapping of blocks frequently updated occurs and an unnecessary erase operation accompanying the swapping occurs additionally, the lifespan of the entire flash memory is reduced.